#include "../inc/app_manager_ui.h"

#if APP_MANAGER_LIB_ENABLE

static void (*app_load_ui_cb)(void *ui, void *anim, uint16_t time, uint16_t delay) = NULL;

extern void *app_manager_malloc(size_t size);
extern void app_manager_free(void *ptr);

app_manager_ret_t app_manager_ui_register_load_cb(void (*cb)(void *ui, void *anim, uint16_t time, uint16_t delay))
{
    app_load_ui_cb = cb;
    return APP_MANAGER_SUCCESS;
}

app_manager_ret_t app_manager_ui_load(void *ui, void *anim, uint16_t time, uint16_t delay)
{
    if (app_load_ui_cb != NULL)
    {
        app_load_ui_cb(ui, anim, time, delay);
        return APP_MANAGER_SUCCESS;
    }
    return APP_MANAGER_ERROR;
}

#endif // #if APP_MANAGER_LIB_ENABLE